package app

import im.yagni.driveby.{BrowserTypes, DriveBy, DriveByConfig}
import infrastructure.Id

object WebSpecificationSuite {
  private def useDriveBy() {
    println("### Using DriveBy")
    DriveByConfig.flyHostname = None
    BrowserTypes.chrome.browserBinary = """./tools/GoogleChromePortable/GoogleChromePortable.exe"""
    BrowserTypes.chrome.driverBinary = """./tools/chromedriver/chromedriver.exe"""
    DriveByConfig.browserType = BrowserTypes.chrome
    DriveByConfig.browserInstances = BuildConfig.browserInstances
    DriveByConfig.applicationControllers = List(InProcessApplication("In process", Id.nextPort))
  }

  useDriveBy()

  DriveByConfig.cleanupOnShutdown = BuildConfig.isRunningInIDE
  DriveByConfig.waitTimeout = if (BuildConfig.isRunningOnCI) 10000 else 5000
  DriveByConfig.applicationTakeWaitTimeout = if (BuildConfig.isRunningOnCI) 240000 else 60000
  DriveByConfig.browserTakeWaitTimeout = if (BuildConfig.isRunningOnCI) 300000 else 60000
  //DriveByConfig.trackingVerbose = if (BuildConfig.isRunningOnCI) true else false
  //DriveByConfig.reportAlways = BuildConfig.isRunningOnCI
  //DriveByConfig.trackingFullDump = BuildConfig.isRunningOnCI

  DriveBy.start()
}